package cn.dz.service.impl;

import cn.dz.dao.UserDao;
import cn.dz.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @ClassName UserServiceImpl
 * @package: cn.dz.service.impl
 * @Description UserServiceImpl
 * @Author dz
 * @Date 2025/2/10 15:32
 * @Version 1.0
 **/
//@Component("userService")
@Service("userService")
public class UserServiceImpl implements UserService {

    //@Autowred
    @Autowired //根据类型进行注入,如果同一个类型的Bean有多个，尝试根据名字进行二次匹配
    @Qualifier("userDao") //在此,结合@Autowired一起使用,作用是根据名称注入相应的Bean
    // @Resource("userDao2") //不指定名称参数,根据类型注入,指定名称就根据名称注入
    private UserDao userDao;


    @Override
    public void show() {
        System.out.println(userDao);
    }
}
